#ifndef LOG2_H
#define LOG2_H
#define LOG2(n) ((n)&(1<<31)?32:(n)&(1<<30)?31:(n)&(1<<29)?30:(n)&(1<<28)?29:(n)&(1<<27)?28:(n)&(1<<26)?27:(n)&(1<<25)?26:(n)&(1<<24)?25:(n)&(1<<23)?24:(n)&(1<<22)?23:(n)&(1<<21)?22:(n)&(1<<20)?21:(n)&(1<<19)?20:(n)&(1<<18)?19:(n)&(1<<17)?18:(n)&(1<<16)?17:(n)&(1<<15)?16:(n)&(1<<14)?15:(n)&(1<<13)?14:(n)&(1<<12)?13:(n)&(1<<11)?12:(n)&(1<<10)?11:(n)&(1<<9)?10:(n)&(1<<8)?9:(n)&(1<<7)?8:(n)&(1<<6)?7:(n)&(1<<5)?6:(n)&(1<<4)?5:(n)&(1<<3)?4:(n)&(1<<2)?3:(n)&(1<<1)?2:(n)&(1<<0)?1:0)

#define MAXVALUE(n)  (1 == sizeof(n) ? 0xff:2 == sizeof(n) ? 0xffff:3 == sizeof(n) ? 0xffffff:4 == sizeof(n) ? 0xffffffff:0)

#endif
